package com.itheima02;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class hashmap {
    public static void main(String[] args) {
        HashMap<String, String> s = new HashMap<>();
        s.put("zhangsan", "wangwu");
        s.put("lisi", "zhaoliu");
        s.put("qianqi", "dashi");
        System.out.println("============================");
        Set<String> s1 = s.keySet();
        for (String key : s1) {
            String value = s.get(key);
            System.out.println("丈夫:" + key + ",妻子:" + value);
        }
        System.out.println("=============================");
        Set<Map.Entry<String, String>> entries = s.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println("丈夫:" + key + ",妻子:" + value);
        }
        System.out.println("=============================");
        s.forEach((key, value) -> System.out.println("丈夫:" + key + ",妻子:" + value));
    }
}
